/*
               File: C49
        Description: Conversion for table MMCNV10
             Author: GeneXus Java Generator version 8_0_9-040
       Generated on: 27 de Setiembre de 2010 16:9:35.18
       Program type: Callable routine
          Main DBMS: sqlserver
*/
import java.sql.*;
import com.genexus.db.*;
import com.genexus.*;
import com.genexus.distributed.*;

public final class c49 extends GXProcedure
{
   public c49( int remoteHandle )
   {
      super( remoteHandle , new ModelContext( c49.class ), "" );
   }

   public c49( int remoteHandle ,
               ModelContext context )
   {
      super( remoteHandle , context, "" );
   }

   public void execute( )
   {
      execute_int();
   }

   private void execute_int( )
   {
      initialize();
      /* GeneXus formulas */
      /* Output device settings */
      /* Using cursor C492 */
      pr_default.execute(0);
      while ( (pr_default.getStatus(0) != 101) )
      {
         A569CnvUUM = C492_A569CnvUUM[0] ;
         A568CnvHUM = C492_A568CnvHUM[0] ;
         A567CnvFUM = C492_A567CnvFUM[0] ;
         A566CnvUCR = C492_A566CnvUCR[0] ;
         A565CnvHCR = C492_A565CnvHCR[0] ;
         A564CnvFCR = C492_A564CnvFCR[0] ;
         A563CnvNro = C492_A563CnvNro[0] ;
         A562CerCod = C492_A562CerCod[0] ;
         A561CnvCap = C492_A561CnvCap[0] ;
         A560CnvCod = C492_A560CnvCod[0] ;
         A559CnvMar = C492_A559CnvMar[0] ;
         A558CnvSer = C492_A558CnvSer[0] ;
         A557CnvMod = C492_A557CnvMod[0] ;
         A556CnvMar = C492_A556CnvMar[0] ;
         A555CnvTip = C492_A555CnvTip[0] ;
         A554CnvCod = C492_A554CnvCod[0] ;
         /*
            INSERT RECORD ON TABLE GXA0049

         */
         AV2CnvCod = A554CnvCod ;
         if ( C492_n555CnvTip[0] )
         {
            AV3CnvTipG = 0 ;
         }
         else
         {
            AV3CnvTipG = (byte)(A555CnvTip) ;
         }
         if ( C492_n556CnvMar[0] )
         {
            AV4CnvMarE = "" ;
         }
         else
         {
            AV4CnvMarE = A556CnvMar ;
         }
         if ( C492_n557CnvMod[0] )
         {
            AV5CnvModE = "" ;
         }
         else
         {
            AV5CnvModE = A557CnvMod ;
         }
         if ( C492_n558CnvSer[0] )
         {
            AV6CnvSerE = "" ;
         }
         else
         {
            AV6CnvSerE = A558CnvSer ;
         }
         if ( C492_n559CnvMar[0] )
         {
            AV7CnvMarC = "" ;
         }
         else
         {
            AV7CnvMarC = A559CnvMar ;
         }
         if ( C492_n560CnvCod[0] )
         {
            AV8CnvCodC = "" ;
         }
         else
         {
            AV8CnvCodC = A560CnvCod ;
         }
         if ( C492_n561CnvCap[0] )
         {
            AV9CnvCapC = "" ;
         }
         else
         {
            AV9CnvCapC = A561CnvCap ;
         }
         if ( C492_n562CerCod[0] )
         {
            AV10CerCod = 0 ;
         }
         else
         {
            AV10CerCod = A562CerCod ;
         }
         if ( C492_n563CnvNro[0] )
         {
            AV11CnvNro = "" ;
         }
         else
         {
            AV11CnvNro = A563CnvNro ;
         }
         if ( C492_n564CnvFCR[0] )
         {
            AV12CnvFCR = GXutil.nullDate() ;
         }
         else
         {
            AV12CnvFCR = A564CnvFCR ;
         }
         if ( C492_n565CnvHCR[0] )
         {
            AV13CnvHCR = "" ;
         }
         else
         {
            AV13CnvHCR = A565CnvHCR ;
         }
         if ( C492_n566CnvUCR[0] )
         {
            AV14CnvUCR = "" ;
         }
         else
         {
            AV14CnvUCR = A566CnvUCR ;
         }
         if ( C492_n567CnvFUM[0] )
         {
            AV15CnvFUM = GXutil.nullDate() ;
         }
         else
         {
            AV15CnvFUM = A567CnvFUM ;
         }
         if ( C492_n568CnvHUM[0] )
         {
            AV16CnvHUM = "" ;
         }
         else
         {
            AV16CnvHUM = A568CnvHUM ;
         }
         if ( C492_n569CnvUUM[0] )
         {
            AV17CnvUUM = "" ;
         }
         else
         {
            AV17CnvUUM = A569CnvUUM ;
         }
         /* Using cursor C493 */
         pr_default.execute(1, new Object[] {new Long(AV2CnvCod), new Byte(AV3CnvTipG), AV4CnvMarE, AV5CnvModE, AV6CnvSerE, AV7CnvMarC, AV8CnvCodC, AV9CnvCapC, new Long(AV10CerCod), AV11CnvNro, AV12CnvFCR, AV13CnvHCR, AV14CnvUCR, AV15CnvFUM, AV16CnvHUM, AV17CnvUUM});
         if ( (pr_default.getStatus(1) == 1) )
         {
            Gx_err = (short)(1) ;
            Gx_emsg = localUtil.getMessages().getMessage("noupdate") ;
         }
         else
         {
            Gx_err = 0 ;
            Gx_emsg = "" ;
         }
         /* End Insert */
         pr_default.readNext(0);
      }
      pr_default.close(0);
      cleanup();
   }

   protected void cleanup( )
   {
      exitApplication();
   }

   /* Aggregate/select formulas */
   public void initialize( )
   {
      C492_A569CnvUUM = new String[] {""} ;
      C492_A568CnvHUM = new String[] {""} ;
      C492_A567CnvFUM = new java.util.Date[] {GXutil.nullDate()} ;
      C492_A566CnvUCR = new String[] {""} ;
      C492_A565CnvHCR = new String[] {""} ;
      C492_A564CnvFCR = new java.util.Date[] {GXutil.nullDate()} ;
      C492_A563CnvNro = new String[] {""} ;
      C492_A562CerCod = new long[1] ;
      C492_A561CnvCap = new String[] {""} ;
      C492_A560CnvCod = new String[] {""} ;
      C492_A559CnvMar = new String[] {""} ;
      C492_A558CnvSer = new String[] {""} ;
      C492_A557CnvMod = new String[] {""} ;
      C492_A556CnvMar = new String[] {""} ;
      C492_A555CnvTip = new long[1] ;
      C492_A554CnvCod = new long[1] ;
      A569CnvUUM = "" ;
      A568CnvHUM = "" ;
      A567CnvFUM = GXutil.nullDate() ;
      A566CnvUCR = "" ;
      A565CnvHCR = "" ;
      A564CnvFCR = GXutil.nullDate() ;
      A563CnvNro = "" ;
      A562CerCod = 0 ;
      A561CnvCap = "" ;
      A560CnvCod = "" ;
      A559CnvMar = "" ;
      A558CnvSer = "" ;
      A557CnvMod = "" ;
      A556CnvMar = "" ;
      A555CnvTip = 0 ;
      A554CnvCod = 0 ;
      GIGXA0049 = 0 ;
      AV2CnvCod = 0 ;
      C492_n555CnvTip = new boolean[] {false} ;
      AV3CnvTipG = 0 ;
      C492_n556CnvMar = new boolean[] {false} ;
      AV4CnvMarE = "" ;
      C492_n557CnvMod = new boolean[] {false} ;
      AV5CnvModE = "" ;
      C492_n558CnvSer = new boolean[] {false} ;
      AV6CnvSerE = "" ;
      C492_n559CnvMar = new boolean[] {false} ;
      AV7CnvMarC = "" ;
      C492_n560CnvCod = new boolean[] {false} ;
      AV8CnvCodC = "" ;
      C492_n561CnvCap = new boolean[] {false} ;
      AV9CnvCapC = "" ;
      C492_n562CerCod = new boolean[] {false} ;
      AV10CerCod = 0 ;
      C492_n563CnvNro = new boolean[] {false} ;
      AV11CnvNro = "" ;
      C492_n564CnvFCR = new boolean[] {false} ;
      AV12CnvFCR = GXutil.nullDate() ;
      C492_n565CnvHCR = new boolean[] {false} ;
      AV13CnvHCR = "" ;
      C492_n566CnvUCR = new boolean[] {false} ;
      AV14CnvUCR = "" ;
      C492_n567CnvFUM = new boolean[] {false} ;
      AV15CnvFUM = GXutil.nullDate() ;
      C492_n568CnvHUM = new boolean[] {false} ;
      AV16CnvHUM = "" ;
      C492_n569CnvUUM = new boolean[] {false} ;
      AV17CnvUUM = "" ;
      Gx_err = 0 ;
      Gx_emsg = "" ;
      pr_default = new DataStoreProvider(context, remoteHandle, new c49__default(),
         new Object[] {
             new Object[] {
            C492_A569CnvUUM, C492_n569CnvUUM, C492_A568CnvHUM, C492_n568CnvHUM, C492_A567CnvFUM, C492_n567CnvFUM, C492_A566CnvUCR, C492_n566CnvUCR, C492_A565CnvHCR, C492_n565CnvHCR,
            C492_A564CnvFCR, C492_n564CnvFCR, C492_A563CnvNro, C492_n563CnvNro, C492_A562CerCod, C492_n562CerCod, C492_A561CnvCap, C492_n561CnvCap, C492_A560CnvCod, C492_n560CnvCod,
            C492_A559CnvMar, C492_n559CnvMar, C492_A558CnvSer, C492_n558CnvSer, C492_A557CnvMod, C492_n557CnvMod, C492_A556CnvMar, C492_n556CnvMar, C492_A555CnvTip, C492_n555CnvTip,
            C492_A554CnvCod
            }
            , new Object[] {
            }
         }
      );
      /* GeneXus formulas. */
      Gx_err = 0 ;
   }

   private byte AV3CnvTipG ;
   private short Gx_err ;
   private int GIGXA0049 ;
   private long A562CerCod ;
   private long A555CnvTip ;
   private long A554CnvCod ;
   private long AV2CnvCod ;
   private long AV10CerCod ;
   private String A569CnvUUM ;
   private String A568CnvHUM ;
   private String A566CnvUCR ;
   private String A565CnvHCR ;
   private String A563CnvNro ;
   private String A561CnvCap ;
   private String A560CnvCod ;
   private String A559CnvMar ;
   private String A558CnvSer ;
   private String A557CnvMod ;
   private String A556CnvMar ;
   private String AV4CnvMarE ;
   private String AV5CnvModE ;
   private String AV6CnvSerE ;
   private String AV7CnvMarC ;
   private String AV8CnvCodC ;
   private String AV9CnvCapC ;
   private String AV11CnvNro ;
   private String AV13CnvHCR ;
   private String AV14CnvUCR ;
   private String AV16CnvHUM ;
   private String AV17CnvUUM ;
   private String Gx_emsg ;
   private java.util.Date A567CnvFUM ;
   private java.util.Date A564CnvFCR ;
   private java.util.Date AV12CnvFCR ;
   private java.util.Date AV15CnvFUM ;
   private IDataStoreProvider pr_default ;
   private String[] C492_A569CnvUUM ;
   private String[] C492_A568CnvHUM ;
   private java.util.Date[] C492_A567CnvFUM ;
   private String[] C492_A566CnvUCR ;
   private String[] C492_A565CnvHCR ;
   private java.util.Date[] C492_A564CnvFCR ;
   private String[] C492_A563CnvNro ;
   private long[] C492_A562CerCod ;
   private String[] C492_A561CnvCap ;
   private String[] C492_A560CnvCod ;
   private String[] C492_A559CnvMar ;
   private String[] C492_A558CnvSer ;
   private String[] C492_A557CnvMod ;
   private String[] C492_A556CnvMar ;
   private long[] C492_A555CnvTip ;
   private long[] C492_A554CnvCod ;
   private boolean[] C492_n555CnvTip ;
   private boolean[] C492_n556CnvMar ;
   private boolean[] C492_n557CnvMod ;
   private boolean[] C492_n558CnvSer ;
   private boolean[] C492_n559CnvMar ;
   private boolean[] C492_n560CnvCod ;
   private boolean[] C492_n561CnvCap ;
   private boolean[] C492_n562CerCod ;
   private boolean[] C492_n563CnvNro ;
   private boolean[] C492_n564CnvFCR ;
   private boolean[] C492_n565CnvHCR ;
   private boolean[] C492_n566CnvUCR ;
   private boolean[] C492_n567CnvFUM ;
   private boolean[] C492_n568CnvHUM ;
   private boolean[] C492_n569CnvUUM ;
}

final class c49__default extends DataStoreHelperBase implements ILocalDataStoreHelper
{
   public Cursor[] getCursors( )
   {
      return new Cursor[] {
          new ForEachCursor("C492", "SELECT [CnvUUM], [CnvHUM], [CnvFUM], [CnvUCR], [CnvHCR], [CnvFCR], [CnvNroCer], [CerCod], [CnvCapCil], [CnvCodCil], [CnvMarCil], [CnvSerEqui], [CnvModEqui], [CnvMarEqui], [CnvTipGas], [CnvCod] FROM [MMCNV10] WITH (NOLOCK) ORDER BY [CnvCod] ",false, GX_NOMASK + GX_MASKLOOPLOCK, false, this,0,false )
         ,new UpdateCursor("C493", "INSERT INTO [GXA0049] ([CnvCod], [CnvTipGas], [CnvMarEqui], [CnvModEqui], [CnvSerEqui], [CnvMarCil], [CnvCodCil], [CnvCapCil], [CerCod], [CnvNroCer], [CnvFCR], [CnvHCR], [CnvUCR], [CnvFUM], [CnvHUM], [CnvUUM]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", GX_NOMASK + GX_MASKLOOPLOCK)
      };
   }

   public void getResults( int cursor ,
                           IFieldGetter rslt ,
                           Object[] buf ) throws SQLException
   {
      switch ( cursor )
      {
            case 0 :
               ((String[]) buf[0])[0] = rslt.getString(1, 10) ;
               ((boolean[]) buf[1])[0] = rslt.wasNull();
               ((String[]) buf[2])[0] = rslt.getString(2, 8) ;
               ((boolean[]) buf[3])[0] = rslt.wasNull();
               ((java.util.Date[]) buf[4])[0] = rslt.getGXDate(3) ;
               ((boolean[]) buf[5])[0] = rslt.wasNull();
               ((String[]) buf[6])[0] = rslt.getString(4, 10) ;
               ((boolean[]) buf[7])[0] = rslt.wasNull();
               ((String[]) buf[8])[0] = rslt.getString(5, 8) ;
               ((boolean[]) buf[9])[0] = rslt.wasNull();
               ((java.util.Date[]) buf[10])[0] = rslt.getGXDate(6) ;
               ((boolean[]) buf[11])[0] = rslt.wasNull();
               ((String[]) buf[12])[0] = rslt.getString(7, 50) ;
               ((boolean[]) buf[13])[0] = rslt.wasNull();
               ((long[]) buf[14])[0] = rslt.getLong(8) ;
               ((boolean[]) buf[15])[0] = rslt.wasNull();
               ((String[]) buf[16])[0] = rslt.getString(9, 50) ;
               ((boolean[]) buf[17])[0] = rslt.wasNull();
               ((String[]) buf[18])[0] = rslt.getString(10, 50) ;
               ((boolean[]) buf[19])[0] = rslt.wasNull();
               ((String[]) buf[20])[0] = rslt.getString(11, 50) ;
               ((boolean[]) buf[21])[0] = rslt.wasNull();
               ((String[]) buf[22])[0] = rslt.getString(12, 50) ;
               ((boolean[]) buf[23])[0] = rslt.wasNull();
               ((String[]) buf[24])[0] = rslt.getString(13, 50) ;
               ((boolean[]) buf[25])[0] = rslt.wasNull();
               ((String[]) buf[26])[0] = rslt.getString(14, 50) ;
               ((boolean[]) buf[27])[0] = rslt.wasNull();
               ((long[]) buf[28])[0] = rslt.getLong(15) ;
               ((boolean[]) buf[29])[0] = rslt.wasNull();
               ((long[]) buf[30])[0] = rslt.getLong(16) ;
               break;
      }
   }

   public void setParameters( int cursor ,
                              IFieldSetter stmt ,
                              Object[] parms ) throws SQLException
   {
      switch ( cursor )
      {
            case 1 :
               stmt.setLong(1, ((Long) parms[0]).longValue());
               stmt.setByte(2, ((Byte) parms[1]).byteValue());
               stmt.setString(3, (String)parms[2], 50);
               stmt.setString(4, (String)parms[3], 50);
               stmt.setString(5, (String)parms[4], 50);
               stmt.setString(6, (String)parms[5], 50);
               stmt.setString(7, (String)parms[6], 50);
               stmt.setString(8, (String)parms[7], 50);
               stmt.setLong(9, ((Long) parms[8]).longValue());
               stmt.setString(10, (String)parms[9], 50);
               stmt.setDate(11, (java.util.Date)parms[10]);
               stmt.setString(12, (String)parms[11], 8);
               stmt.setString(13, (String)parms[12], 10);
               stmt.setDate(14, (java.util.Date)parms[13]);
               stmt.setString(15, (String)parms[14], 8);
               stmt.setString(16, (String)parms[15], 10);
               break;
      }
   }

}

